package com.atguigu.yygh.cmn.controller.user;

import com.atguigu.yygh.cmn.service.DictService;
import com.atguigu.yygh.common.result.R;
import com.atguigu.yygh.model.cmn.Dict;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author luoyin
 * @Date 15:02 2022/9/30
 **/
@RestController
@RequestMapping("/user/cmn")
public class UserDictController {

    @Autowired
    DictService dictService;

    @ApiOperation("根据父节点查询子节点数组")
    @GetMapping("/getList/{pid}")
    public R getDictListByParentId(@PathVariable Long pid){
        List<Dict> dictList = dictService.getDictListByParentId(pid);
        return R.ok().data("list",dictList);
    }
}
